#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define y1 y_alpha_1

using namespace std;

using ll = long long;
using db = double;
using vec = vector<int>;
using pii = pair<int,int>;

int read(){
	int x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-',ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48),ch = getchar();
	return f ? -x : x;
}

const int N = 3e5 + 10;

int f[52][N];
ll ans = 0;

int main(){
#ifndef ONLINE_JUDGE
	//	freopen("1.in","r",stdin);
#endif
	f[0][0] = 1;
	for(int i = 1;i <= 100;i++){
		int x = i * i; int l = (i - 1) * (i - 1) * (i - 1); l = min(l,N - 1);
		for(int j = min(i - 1,50);j >= 0;j--)
			for(int s = 0;s <= l;s++)
				f[j + 1][s + x] = min(f[j + 1][s + x] + f[j][s],2);
	}
	for(int i = 0;i < N - 10;i++) if(f[50][i] > 0 && f[50][i] < 2) ans += i;
	printf("%lld\n",ans);
	return 0;
}
